﻿using Microsoft.VisualStudio.Modeling.Diagrams;

namespace Microsoft.Modeling.StoryboardDesigner.Extensions.Features.HighlightLinkedShapes
{
    internal static class Highlighter
    {
        private const float unlinkedThickness = 0.0125f;
        private const float linkedThickness = 0.03f;

        internal static void HighlightShape(this IStoryboardPel pel, ShapeElement shape)
        {
            if(!shape.Store.TransactionActive)
            {
                return;
            }

            StoryboardElement storyboardElement = shape.ModelElement as StoryboardElement;

            if(storyboardElement == null)
            {
                return;
            }

            if(string.IsNullOrEmpty(storyboardElement.LinkedFile))
            {
                pel.OutlineThickness = unlinkedThickness;
            }
            else
            {
                pel.OutlineThickness = linkedThickness;
            }
        }
    }
}